#pragma once
#include <HPSocket\HPSocket.h>
#include<functional>
#include"Variant.h"
#include "global.h"
#include "NetDef.h"
#include <sstream>
#include <memory>

class DServerInf;

class RPCFW_API DNetServer 
{
public:
    typedef std::function<void(Variant &)> RecvCallback;
    typedef std::function<void()> ErrCb;
    
public:
    DNetServer();
	~DNetServer();
    void init(std::string addr,int port );
    void sendData(const Variant &);
    void setRecvCb(const RecvCallback &);
    void setErrorCb(const ErrCb &);

private:
	DServerInf *m_ServerInf;
    RecvCallback m_recvCb;
    ErrCb m_ErrCb;
    ITcpServer *m_pTcpServer;
};